//导入express这个包，所有第三方包都需要require('包名')
var express = require("express")

var {expressjwt}=require('express-jwt')

var app = express()



// var tewRouter=require('./router/tewRouter.js')

app.use(express.static('static'))


app.use(express.json())
app.use(express.urlencoded({ extended: false }))

//验证token验证的中间件（走token去验证）
//unless设置白名单
app.use(expressjwt({
    secret:'1234',
    algorithms:['HS256'],
}).unless({path:['/one/login','/one/register']}))
var oneRouter=require('./router/oneRouter.js')
//注册子路由
app.use('/one',oneRouter)
// app.use('./tew',tewRouter)

app.listen(8080, () => {
    console.log('服务器运行在:http://localhost8080');
});


